﻿using System;
using System.Web.UI;
using System.Web;
using System.Collections.Generic;
  

namespace SiteUnity.Layers.Application.BaseClasses
{
    public class BasePage : Page
    {
        public SiteUnity.Layers.Entity.General.Page CurrentPage;
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            CurrentPage=SiteManager.Website.CurrentPage;

            //if (HttpContext.Current.Request.RawUrl.Contains(".aspx"))
            //    Response.Redirect(SiteManager.Website.CurrentPage.Url);
                
            Page.Title = CurrentPage.Title + " - " + SiteManager.Website.Name;
        }

        protected override void OnPreRender(EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(typeof(Page), "pageready", string.Format("var PageGuid = '{0}';",SiteManager.Website.CurrentPage.Guid), true);
        }
    }
}